# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=fribidi

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.19.6
pkgrel=2
pkgdesc="A Free Implementation of the Unicode Bidirectional Algorithm (mingw-w64)"
arch=('any')
license=('LGPL')
url="http://fribidi.org"
depends=("${MINGW_PACKAGE_PREFIX}-glib2")
options=('strip' '!libtool' 'staticlibs')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=("http://fribidi.org/download/${_realname}-${pkgver}.tar.bz2"
    0001-no-need-for-a-second-export-symbols.mingw.patch
    0003-fix-eols-in-tests-on.mingw.patch)
md5sums=('ce93d862344991173dabb609bf93ca1d'
         'c304e96ab7709280386635135ee53cc9'
         '98a7907bee0060f3e72e2afa26b71cd9')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/0001-no-need-for-a-second-export-symbols.mingw.patch
  patch -p1 -i ${srcdir}/0003-fix-eols-in-tests-on.mingw.patch
}

build() {
  mkdir -p ${srcdir}/build-${MINGW_CHOST} && cd ${srcdir}/build-${MINGW_CHOST}
  ${srcdir}/${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-static \
    --with-glib

  #touch ${srcdir}/${_realname}-${pkgver}/doc/c2man.stamp
  #touch ${srcdir}/${_realname}-${pkgver}/doc/*.3
  make
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}
  make DESTDIR="${pkgdir}" install
}
